Dexter's log

Dexter's log

Debugging .NET application fails in JetBrains' Rider

(Updated on )

I like JetBrains’ Rider; it’s much better than Visual Studio (VS), but it can fail running .NET applications in the debug mode. So here is a workaround.

TL;DR: Conditionally disable PublishSingleFile for debug builds:

<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile>

I finally gave-up on running Rider and VS in parallel – using Rider for editing, and VS for debugging (don’t ask…). So I dug deeper, why the debug execution in Rider is failing with a nice error message saying:

One or more errors occurred.

Really nice error message ¯\(ツ)/¯. So I searched for it and found some information like:

Which are closed/fixed and I assumed everything should work, but it does not. It was a problem in .NET Core 3, and it is still a problem with .NET 8 in Rider 2023.2.3. But it is no problem in Visual Studio 17.8.

The problem is with PublishSingleFile, when set to True. Suggested “solution” is to disable PublishSingleFile, but I want to distribute my application without the .NET dependency! Luckily, there is a better “temporary” solution which is to conditionally disable the PublishSingleFile for debug builds in the .csproj file:

<PublishSingleFile Condition="'$(Configuration)' == 'Release'">true</PublishSingleFile>

Thanks to anze videnic for this workaround!